package com.joysuch.wwyt.patrol.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.patrol.entity.PatrolCheckPoint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.joysuch.wwyt.patrol.entity.vo.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zr
 * @since 2022-02-28
 */
@Repository
public interface PatrolCheckPointMapper extends BaseMapper<PatrolCheckPoint> {

    List<CheckPlanDetailPointVo> findPlanPointByPlanId(Long tenentId, String orgCode, Long planId);

    /**
     * 检查点分页
     * @param pageVoPage
     * @param areaId
     * @return
     */
    Page<CheckPointPageVo> findListForPage(Page<CheckPointPageVo> pageVoPage, Long areaId, Long tenentId, String orgCode, Long typeId , String pointName);

    /**
     * 根据id查找检查点详情
     * @param id
     * @return
     */
    CheckPointDetailVo getPointById(Long id);

    List<CheckPointListVo> getPointList(Long tenentId, String orgCode);

    void deletePointById(Long pointId);

    /**
     * 判断此检查点名称的是否重复
     * @param checkPointName
     * @return
     */
    Long judgeForName(String checkPointName,Long tenentId,String orgCode);

    /**
     * 判断此检查点名称除了自己有没有重复
     * @param checkPointName
     * @param tenentId
     * @param orgCode
     * @return
     */
    Long judgeForNameExcludeSelf(Long id, String checkPointName, Long tenentId, String orgCode);

    /**
     *  查看该检查点被多少正在使用的检查计划所绑定
     * @param pointId
     * @return
     */
    List<String> findBind(Long tenentId, String orgCode, Long pointId);

    PatrolCheckPoint selectLocationById(Long id);

    String findNameById(Long pointId, Long tenentId, String orgCode);

}
